package insight.miescor.opp.domain;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

public class AssignmentGrid extends Assignment {

	private String title;
	private String projectType;
	private String initiator;
	private Date createdOn;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getProjectType() {
		return projectType;
	}

	public void setProjectType(String projectType) {
		this.projectType = projectType;
	}

	public JSONObject getJson() throws JSONException {
		SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
		JSONObject jObj = new JSONObject()
				.put("id", this.getId())
				.put("opportunityId", this.getOpportunityId())
				.put("startDate", this.getStartDate())
				.put("endDate", this.getEndDate())
				.put("status", this.getStatus())
				.put("stepId", this.getStepId())
				.put("title", this.getTitle())
				.put("type", this.getProjectType())
				.put("role", this.getRole())
				.put("userId", this.getUserId())
				.put("prjObjId", this.getProjectObjId())
				.put("Initiator", this.getInitiator())
				.put("CreatedOn",
						(this.getCreatedOn() != null ? sdf.format(this
								.getCreatedOn()) : ""));

		return jObj;
	}

	public String getInitiator() {
		return initiator;
	}

	public void setInitiator(String initiator) {
		this.initiator = initiator;
	}

	public Date getCreatedOn() {
		return createdOn;
	}

	public void setCreatedOn(Date createdOn) {
		this.createdOn = createdOn;
	}

}
